package com.anycc.cloud.core.dto;

import com.anycc.cloud.core.entity.Module;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * menu
 */
@Data
public class Menu implements Serializable {
    private static final long serialVersionUID = -8159230699818646986L;

    private String name;
    private String url;
    private String target;
    private String icon;
    private String sn;
    private boolean selected;
    private List<Menu> children;

    public Menu() {
        this.selected = false;
        this.children = new ArrayList<>();
    }

    public Menu(String name, String icon, String sn) {
        this.selected = false;
        this.children = new ArrayList<>();
        this.name = name;
        this.icon = icon;
        this.sn = sn;
    }

    public Menu(String name, String icon, String sn, String target, String url) {
        this(name, icon, sn);
        this.target = target;
        this.url = url;
    }

    public Menu(String name, String icon, String sn, String target, String url, boolean selected) {
        this(name, icon, sn, target, url);
        this.selected = selected;
    }

    public Menu(Module module, String url, boolean selected) {
        this.name = module.getName();
        this.icon = module.getIcon();
        this.sn = module.getSn();
        this.target = module.getTarget();
        this.url = url;
        this.selected = selected;
    }
}
